{% import '@SyliusAdmin/Common/Macro/money.html.twig' as money %}
{% import '@SyliusUi/Macro/buttons.html.twig' as buttons %}

{% if credit_memos|length > 0 %}
    <div class="ui segment" id="credit-memos">
        <h3 class="ui dividing header">{{ 'sylius_refund.ui.credit_memos'|trans }}</h3>
        <table class="ui celled compact small table fixed">
            <thead>
            <tr>
                <th>{{ 'sylius.ui.number'|trans }}</th>
                <th>{{ 'sylius.ui.total'|trans }}</th>
                <th>{{ 'sylius_refund.ui.issued_at'|trans }}</th>
                <th>{{ 'sylius.ui.actions'|trans }}</th>
            </tr>
            </thead>
            <tbody>
            {% for credit_memo in credit_memos %}
                <tr>
                    <td>{{ credit_memo.number }}</td>
                    <td>{{ credit_memo.total|sylius_format_money(credit_memo.currencyCode, credit_memo.localeCode) }}</td>
                    <td>{{ credit_memo.issuedAt|date('d-m-Y') }}</td>
                    <td>
                        {% set path = path('sylius_refund_shop_credit_memo_download', { 'id': credit_memo.id }) %}

                        {{ buttons.default(path, 'sylius_refund.ui.download'|trans, credit_memo.id, 'download') }}
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
{% endif %}
